﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IT_Project_Monopoly
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            this.gPannel.setPlayerInfo("Stefan", 290f, 0, "Images\\aa.jpg");
            this.gPannel.addPlayer("Stefan", 290f, 0);
            this.gPannel.addPlayer("Jovan", 220f, 0);
            this.gPannel.addPlayer("Angela", 200f, 0);
            this.gPannel.addPlayer("Stojce", 180f, 0);
        }

        protected void click(object sender, EventArgs e)
        {
            this.gPannel.activateNext();
        }

        protected void addMoneyButton(object sender, EventArgs e)
        {
            this.gPannel.PlayerMoney += float.Parse(this.money.Text.Trim());
        }

        protected void subMoneyButton(object sender, EventArgs e)
        {
            this.gPannel.PlayerMoney -= float.Parse(this.money.Text.Trim());
        }

        protected void addMoneyActivePlayer(object sender, EventArgs e)
        {
            if(this.gPannel.getActiveIndex() >= 0)
            this.gPannel.getActivePlayer().PlayerMoney += float.Parse(this.money.Text);
        }

        protected void subMoneyActivePlayer(object sender, EventArgs e)
        {
            if (this.gPannel.getActiveIndex() >= 0)
            this.gPannel.getActivePlayer().PlayerMoney -= float.Parse(this.money.Text);
        }

        protected void addMortgage(object sender, EventArgs e)
        {
            this.gPannel.AddMortgage(this.mortName.Text, "20:00");
        }

        protected void addTransaction(object sender, EventArgs e)
        {
            this.gPannel.AddLog(float.Parse(this.amount.Text.Replace('.', ',')), "23:00");
        }

        protected void enableConts_Click(object sender, EventArgs e)
        {
            this.gPannel.enableGameControls();
        }

        protected void disableConts_Click(object sender, EventArgs e)
        {
            this.gPannel.disableGameControls();
        }
    }
}